﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using chessLogic;

namespace chessTest
{
    [TestFixture]
    class testGame
    {
        private Game game;
        private Dictionary<string, string> tags;
        [SetUp]
        public void SetUp()
        {
            game = new Game();
            tags = new Dictionary<string, string>();
            tags.Add("Event", "1");
            tags.Add("Site", "2");
            tags.Add("Date", "3");
            tags.Add("Round", "4");
            tags.Add("White", "5");
            tags.Add("Black", "6");
            tags.Add("Result", "1-0");
            tags.Add("ECO", "8");
        }
        [Test]
        public void testSetTags()
        {
            game.setTags(tags);
            Assert.AreEqual(game.Event, "1");
            Assert.AreEqual(game.Black, "6");
        }

        [Test]
        public void testNextMove()
        {
            string[] moves = new string[] { "e4", "g3", "h6" };
            Game game = new Game();
            game.Moves.AddRange(moves);
            Assert.AreEqual("e4", game.NextMove());
            Assert.AreEqual("g3", game.NextMove());
            Assert.AreEqual("h6", game.NextMove());
            Assert.True(game.IsFinished());
        }
        [Test]
        public void testGetWinesToString()
        {
            game.setTags(tags);
            Assert.AreEqual("White Won!", game.getWinner());
        }
        [Test]
        public void testWhoMoved()
        {
            string[] moves = new string[] { "e4", "g3", "h6" };
            Game game = new Game();
            game.Moves.AddRange(moves);
            Assert.AreEqual(FigureColor.White, game.getWhoMove());
            game.NextMove();
            Assert.AreEqual(FigureColor.Black, game.getWhoMove());
        }
    }
}
